﻿package {
	import flash.display.Sprite;
	import flash.display.Stage;
	import flash.display.StageAlign;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	
	import dk.lbi.localTrace.LocalTrace;	
	/**
	 * @author pettot
	 */
	public class testApp extends Sprite
	{
		//	trace	examples:
		private	function	onTrace(...args):void{LocalTrace.send('onTrace',String(Object(this).constructor),args);}
 		private	function	eTrace(...args):void{LocalTrace.send('eTrace',String(Object(this).constructor),args);}
		private	function	wTrace(...args):void{LocalTrace.send('wTrace',String(Object(this).constructor),args);}
		private	function	hTrace(...args):void{LocalTrace.send('hTrace',String(Object(this).constructor),args);}
		private	function	gTrace(...args):void{LocalTrace.send('gTrace',String(Object(this).constructor),args);}
		private	function	bTrace(...args):void{LocalTrace.send('bTrace',String(Object(this).constructor),args);}
		private	function	yTrace(...args):void{LocalTrace.send('yTrace',String(Object(this).constructor),args);}
		private	function	mTrace(...args):void{LocalTrace.send('mTrace',String(Object(this).constructor),args);}
		private	function	cTrace(...args):void{LocalTrace.send('cTrace',String(Object(this).constructor),args);}
		private	function	sTrace(...args):void{LocalTrace.send('sTrace',String(Object(this).constructor),args);}
		//	init
		public	function	testApp()
		{
			if(stage is Stage)
			{
				stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouse);
				stage.addEventListener(MouseEvent.CLICK, onMouse);
				stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouse);
				stage.addEventListener(MouseEvent.MOUSE_UP, onMouse);
				stage.addEventListener(MouseEvent.MOUSE_WHEEL, onMouse);
				stage.addChild(new TextField());
				TextField(stage.getChildAt(1)).width=200;
				stage.align=StageAlign.TOP_LEFT;
			}
		}
		private	function	onMouse(e:MouseEvent):void
		{
			if(e.type==MouseEvent.MOUSE_MOVE && e.stageX>stage.width>>2){return;}
			var txt:String='	mouse	X='+e.stageX+'	Y='+e.stageY+'	'+e.type;
			TextField(stage.getChildAt(1)).text=txt;
			switch(String(Math.random()).charAt(2))
			{
				case'1':onTrace(txt);			return;
				case'2':wTrace(''+txt);			return;
				case'3':hTrace(txt);			return;
				case'4':gTrace(txt);			return;
				case'5':bTrace(txt);			return;
				case'6':yTrace(txt);			return;
				case'7':mTrace(txt);			return;
				case'8':cTrace(txt);			return;
				case'9':sTrace(txt);			return;

				default:eTrace(txt);
			}

		}
	}
}
